﻿import QtQuick 2.0

MAbstractRole {
    id: roleRoot; 
    property alias color: roleItem.color;
    width: 66;
    height: column.height;
    
    Column{
        id: column;
        width: parent.width;
        spacing: 8;
        
        Text {
            font.pointSize: 9;
            style: Text.Sunken;
            color: "black";
            styleColor: "green";
            anchors.horizontalCenter: parent.horizontalCenter;
            text: name;
        }
        
        Rectangle{
            id: blRect;
            width: parent.width;
            height: 12;
            color: Qt.rgba(1,1,1,0.5);
            border.color: "black";
            Rectangle{
                width: (parent.width-parent.border.width*2) * blood;
                height: parent.height-parent.border.width*2;
                color: (isCur ? "green" : "red");
                anchors.verticalCenter: parent.verticalCenter;
                x: parent.border.width;
            }
            Repeater{
                id: bRep;
                property int itemWd: blRect.width/count;
                model: 8;
                delegate: Rectangle{
                    height: blRect.height*0.66;
                    width: 1;
                    anchors.verticalCenter: parent.verticalCenter;
                    x: index * bRep.itemWd;
                    color: "black";
                    visible: index>0;
                }
            }
        }
        
        Rectangle{
            id: roleItem;
            width: parent.width;
            height: 88;
            color: Qt.rgba((Math.random()*10000)%255/100,(Math.random()*10000)%255/100,(Math.random()*10000)%255/100,0.9);
            radius: 2;
            border.color: "black";
        }
    }
}
